package net.zjitc.utils;

import lombok.Data;

@Data
public class APIResponse<T> {
    private Integer errno;
    private String errmsg;
    private T data;
    public APIResponse() {
    }
    public APIResponse(Integer errno, String errmsg, T data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }
    public void success(String errmsg, T data) {
        this.errno = 0;
        this.errmsg = errmsg;
        this.data =  data;
    }
    public void fail(Integer num,String errmsg, T data) {
        this.errno = num;
        this.errmsg = errmsg;
        this.data =  data;
    }
}
